package gov.child.entities.po;

import gov.child.entities.vo.annotation.Alias;
import gov.child.entities.vo.annotation.IgnoreField;

import javax.persistence.*;
import java.util.Date;

/**
 * @author fzh
 * @since 2017/9/16
 */
@Entity
@Table(name = "enterprise_declare_form", schema = "gov_c")
public class EEnterpriseDeclareForm {
    @Alias("enterpriseDeclareFormId")
    private Integer id;
    private String uniformCode;
    private Integer userId;
    private Integer guideId;
    private String name;
    private Byte isMultiCredentials;
    private String uniformSocityCreditCode;
    private String organizationCode;
    private String organizationCredentialsIssue;
    private Date organizationCredentialsDate;
    private Date organizationCredentialsStart;
    private Date organizationCredentialsEnd;
    private String organizationEnglishName;
    private String organizationType;
    private String organizationStatus;
    private String enterpriseType;
    private String enterpriseTypeCode;
    private String representative;
    private String representativeType;
    private String representativeCredential;
    private String representativeIdnum;
    private String tel;
    private String conact;
    private Date registDate;
    private String registAddr;
    private String info;
    private Byte status;

    @IgnoreField
    private EGuide guideByGuideId;
    @IgnoreField
    private EUser userByUserId;
    private Date createTime;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id", nullable = false)
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Basic
    @Column(name = "uniform_code", nullable = false, length = 60)
    public String getUniformCode() {
        return uniformCode;
    }

    public void setUniformCode(String uniformCode) {
        this.uniformCode = uniformCode;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "guide_id", nullable = false)
    public Integer getGuideId() {
        return guideId;
    }

    public void setGuideId(Integer guideId) {
        this.guideId= guideId;
    }

    @Basic
    @Column(name = "name", nullable = false, length = 30)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "is_multi_credentials", nullable = false)
    public Byte getIsMultiCredentials() {
        return isMultiCredentials;
    }

    public void setIsMultiCredentials(Byte isMultiCredentials) {
        this.isMultiCredentials = isMultiCredentials;
    }

    @Basic
    @Column(name = "uniform_socity_credit_code", nullable = true, length = 18)
    public String getUniformSocityCreditCode() {
        return uniformSocityCreditCode;
    }

    public void setUniformSocityCreditCode(String uniformSocityCreditCode) {
        this.uniformSocityCreditCode = uniformSocityCreditCode;
    }

    @Basic
    @Column(name = "organization_code", nullable = true, length = 9)
    public String getOrganizationCode() {
        return organizationCode;
    }

    public void setOrganizationCode(String organizationCode) {
        this.organizationCode = organizationCode;
    }

    @Basic
    @Column(name = "organization_credentials_issue", nullable = true, length = 20)
    public String getOrganizationCredentialsIssue() {
        return organizationCredentialsIssue;
    }

    public void setOrganizationCredentialsIssue(String organizationCredentialsIssue) {
        this.organizationCredentialsIssue = organizationCredentialsIssue;
    }

    @Basic
    @Column(name = "organization_credentials_date", nullable = true)
    public Date getOrganizationCredentialsDate() {
        return organizationCredentialsDate;
    }

    public void setOrganizationCredentialsDate(Date organizationCredentialsDate) {
        this.organizationCredentialsDate = organizationCredentialsDate;
    }

    @Basic
    @Column(name = "organization_credentials_start", nullable = true)
    public Date getOrganizationCredentialsStart() {
        return organizationCredentialsStart;
    }

    public void setOrganizationCredentialsStart(Date organizationCredentialsStart) {
        this.organizationCredentialsStart = organizationCredentialsStart;
    }

    @Basic
    @Column(name = "organization_credentials_end", nullable = true)
    public Date getOrganizationCredentialsEnd() {
        return organizationCredentialsEnd;
    }

    public void setOrganizationCredentialsEnd(Date organizationCredentialsEnd) {
        this.organizationCredentialsEnd = organizationCredentialsEnd;
    }

    @Basic
    @Column(name = "organization_english_name", nullable = true, length = 60)
    public String getOrganizationEnglishName() {
        return organizationEnglishName;
    }

    public void setOrganizationEnglishName(String organizationEnglishName) {
        this.organizationEnglishName = organizationEnglishName;
    }

    @Basic
    @Column(name = "organization_type", nullable = false, length = 6)
    public String getOrganizationType() {
        return organizationType;
    }

    public void setOrganizationType(String organizationType) {
        this.organizationType = organizationType;
    }

    @Basic
    @Column(name = "organization_status", nullable = false, length = 4)
    public String getOrganizationStatus() {
        return organizationStatus;
    }

    public void setOrganizationStatus(String organizationStatus) {
        this.organizationStatus = organizationStatus;
    }

    @Basic
    @Column(name = "enterprise_type", nullable = true, length = 20)
    public String getEnterpriseType() {
        return enterpriseType;
    }

    public void setEnterpriseType(String enterpriseType) {
        this.enterpriseType = enterpriseType;
    }

    @Basic
    @Column(name = "enterprise_type_code", nullable = true, length = 10)
    public String getEnterpriseTypeCode() {
        return enterpriseTypeCode;
    }

    public void setEnterpriseTypeCode(String enterpriseTypeCode) {
        this.enterpriseTypeCode = enterpriseTypeCode;
    }

    @Basic
    @Column(name = "representative", nullable = true, length = 8)
    public String getRepresentative() {
        return representative;
    }

    public void setRepresentative(String representative) {
        this.representative = representative;
    }

    @Basic
    @Column(name = "representative_type", nullable = true, length = 8)
    public String getRepresentativeType() {
        return representativeType;
    }

    public void setRepresentativeType(String representativeType) {
        this.representativeType = representativeType;
    }

    @Basic
    @Column(name = "representative_credential", nullable = true, length = 12)
    public String getRepresentativeCredential() {
        return representativeCredential;
    }

    public void setRepresentativeCredential(String representativeCredential) {
        this.representativeCredential = representativeCredential;
    }

    @Basic
    @Column(name = "representative_idnum", nullable = true, length = 18)
    public String getRepresentativeIdnum() {
        return representativeIdnum;
    }

    public void setRepresentativeIdnum(String representativeIdnum) {
        this.representativeIdnum = representativeIdnum;
    }

    @Basic
    @Column(name = "tel", nullable = true, length = 14)
    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    @Basic
    @Column(name = "conact", nullable = true, length = 8)
    public String getConact() {
        return conact;
    }

    public void setConact(String conact) {
        this.conact = conact;
    }

    @Basic
    @Column(name = "regist_date", nullable = true)
    public Date getRegistDate() {
        return registDate;
    }

    public void setRegistDate(Date registDate) {
        this.registDate = registDate;
    }

    @Basic
    @Column(name = "regist_addr", nullable = true, length = 40)
    public String getRegistAddr() {
        return registAddr;
    }

    public void setRegistAddr(String registAddr) {
        this.registAddr = registAddr;
    }

    @Basic
    @Column(name = "info", nullable = true, length = 300)
    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }

    @Basic
    @Column(name = "status", nullable = true)
    public Byte getStatus() {
        return status;
    }

    public void setStatus(Byte status) {
        this.status = status;
    }

    @Basic
    @Column(name = "create_time", nullable = true)
    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        EEnterpriseDeclareForm form = (EEnterpriseDeclareForm) o;

        if (id != null ? !id.equals(form.id) : form.id != null) return false;
        if (uniformCode != null ? !uniformCode.equals(form.uniformCode) : form.uniformCode != null) return false;
        if (userId != null ? !userId.equals(form.userId) : form.userId != null) return false;
        if (name != null ? !name.equals(form.name) : form.name != null) return false;
        if (isMultiCredentials != null ? !isMultiCredentials.equals(form.isMultiCredentials) : form.isMultiCredentials != null)
            return false;
        if (uniformSocityCreditCode != null ? !uniformSocityCreditCode.equals(form.uniformSocityCreditCode) : form.uniformSocityCreditCode != null)
            return false;
        if (organizationCode != null ? !organizationCode.equals(form.organizationCode) : form.organizationCode != null)
            return false;
        if (organizationCredentialsIssue != null ? !organizationCredentialsIssue.equals(form.organizationCredentialsIssue) : form.organizationCredentialsIssue != null)
            return false;
        if (organizationCredentialsDate != null ? !organizationCredentialsDate.equals(form.organizationCredentialsDate) : form.organizationCredentialsDate != null)
            return false;
        if (organizationCredentialsStart != null ? !organizationCredentialsStart.equals(form.organizationCredentialsStart) : form.organizationCredentialsStart != null)
            return false;
        if (organizationCredentialsEnd != null ? !organizationCredentialsEnd.equals(form.organizationCredentialsEnd) : form.organizationCredentialsEnd != null)
            return false;
        if (organizationEnglishName != null ? !organizationEnglishName.equals(form.organizationEnglishName) : form.organizationEnglishName != null)
            return false;
        if (organizationType != null ? !organizationType.equals(form.organizationType) : form.organizationType != null)
            return false;
        if (organizationStatus != null ? !organizationStatus.equals(form.organizationStatus) : form.organizationStatus != null)
            return false;
        if (enterpriseType != null ? !enterpriseType.equals(form.enterpriseType) : form.enterpriseType != null)
            return false;
        if (enterpriseTypeCode != null ? !enterpriseTypeCode.equals(form.enterpriseTypeCode) : form.enterpriseTypeCode != null)
            return false;
        if (representative != null ? !representative.equals(form.representative) : form.representative != null)
            return false;
        if (representativeType != null ? !representativeType.equals(form.representativeType) : form.representativeType != null)
            return false;
        if (representativeCredential != null ? !representativeCredential.equals(form.representativeCredential) : form.representativeCredential != null)
            return false;
        if (representativeIdnum != null ? !representativeIdnum.equals(form.representativeIdnum) : form.representativeIdnum != null)
            return false;
        if (tel != null ? !tel.equals(form.tel) : form.tel != null) return false;
        if (conact != null ? !conact.equals(form.conact) : form.conact != null) return false;
        if (registDate != null ? !registDate.equals(form.registDate) : form.registDate != null) return false;
        if (registAddr != null ? !registAddr.equals(form.registAddr) : form.registAddr != null) return false;
        if (info != null ? !info.equals(form.info) : form.info != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (uniformCode != null ? uniformCode.hashCode() : 0);
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (isMultiCredentials != null ? isMultiCredentials.hashCode() : 0);
        result = 31 * result + (uniformSocityCreditCode != null ? uniformSocityCreditCode.hashCode() : 0);
        result = 31 * result + (organizationCode != null ? organizationCode.hashCode() : 0);
        result = 31 * result + (organizationCredentialsIssue != null ? organizationCredentialsIssue.hashCode() : 0);
        result = 31 * result + (organizationCredentialsDate != null ? organizationCredentialsDate.hashCode() : 0);
        result = 31 * result + (organizationCredentialsStart != null ? organizationCredentialsStart.hashCode() : 0);
        result = 31 * result + (organizationCredentialsEnd != null ? organizationCredentialsEnd.hashCode() : 0);
        result = 31 * result + (organizationEnglishName != null ? organizationEnglishName.hashCode() : 0);
        result = 31 * result + (organizationType != null ? organizationType.hashCode() : 0);
        result = 31 * result + (organizationStatus != null ? organizationStatus.hashCode() : 0);
        result = 31 * result + (enterpriseType != null ? enterpriseType.hashCode() : 0);
        result = 31 * result + (enterpriseTypeCode != null ? enterpriseTypeCode.hashCode() : 0);
        result = 31 * result + (representative != null ? representative.hashCode() : 0);
        result = 31 * result + (representativeType != null ? representativeType.hashCode() : 0);
        result = 31 * result + (representativeCredential != null ? representativeCredential.hashCode() : 0);
        result = 31 * result + (representativeIdnum != null ? representativeIdnum.hashCode() : 0);
        result = 31 * result + (tel != null ? tel.hashCode() : 0);
        result = 31 * result + (conact != null ? conact.hashCode() : 0);
        result = 31 * result + (registDate != null ? registDate.hashCode() : 0);
        result = 31 * result + (registAddr != null ? registAddr.hashCode() : 0);
        result = 31 * result + (info != null ? info.hashCode() : 0);
        return result;
    }

    @ManyToOne
    @JoinColumn(name = "user_id", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    public EUser getUserByUserId() {
        return userByUserId;
    }

    public void setUserByUserId(EUser userByUserId) {
        this.userByUserId = userByUserId;
    }

    @ManyToOne
    @JoinColumn(name = "guide_id", referencedColumnName = "id", nullable = false, insertable = false, updatable = false)
    public EGuide getGuideByGuideId() {
        return guideByGuideId;
    }

    public void setGuideByGuideId(EGuide guideByGuideId) {
        this.guideByGuideId = guideByGuideId;
    }
}
